import request from '../util/request'
// 查询部门配置
export function getDepartmentList (data) {
  return request({
    url: '/hospital-system/hospital/department/list',
    method: 'post',
    data: {
      currentPage: data.currentPage,
      name: data.name,
      pageSize: data.pageSize,
      hospitalUuid: data.hospitalUuid
    }
  })
}

// 添加部门配置
export function addDepartment (data) {
  return request({
    url: '/hospital-system/hospital/department/add',
    method: 'put',
    data: {
      code: data.code,
      name: data.name
    }
  })
}

// 根据id删除部门配置
export function deleteDepartment (data) {
  return request({
    url: '/hospital-system/hospital/department/delete',
    method: 'post',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    data: {
      id: data.id
    }
  })
}

// 根据id编辑部门配置
export function updateDepartment (data) {
  return request({
    url: '/hospital-system/hospital/department/edit',
    method: 'post',
    data: {
      id: data.id,
      code: data.code,
      name: data.name
    }
  })
}

// 根据id编辑部门配置检查
export function updateDepartmentCheck (data) {
  return request({
    url: '/hospital-system/hospital/department/edit-check',
    method: 'post',
    data: {
      id: data.id
    }
  })
}

// 查询医生列表
export function getDoctorList (data) {
  return request({
    url: '/hospital-system/hospital/doctor/list',
    method: 'post',
    data: {
      hospitalUuid: data.hospitalUuid,
      name: data.name,
      currentPage: data.currentPage,
      pageSize: data.pageSize,
      department: data.department,
      status: data.status,
      introduce: data.introduce,
      isDelete: data.isDelete,
      type: data.type
    }
  })
}

// 添加图片
export function uploadDoctorPicture (data) {
  return request({
    url: '/hospital-system/upload/picture',
    method: 'post',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    data: {
      file: data.file,
      bucketName: data.bucketName
    }
  })
}

// 删除图片
export function deletePicture (data) {
  return request({
    url: '/hospital-system/upload/picture/delete',
    method: 'post',
    data: {
      objectName: data.objectName,
      bucketName: data.bucketName
    }
  })
}

// 添加医生
export function addDoctor (data) {
  return request({
    url: '/hospital-system/hospital/doctor/add',
    method: 'post',
    data: {
      department: data.department,
      name: data.name,
      password: data.password,
      picture: data.picture,
      pictureName: data.pictureName,
      price: data.price,
      sex: data.sex,
      account: data.account,
      type: data.type,
      works: data.works
    }
  })
}

// 修改医生
export function updateDoctor (data) {
  return request({
    url: '/hospital-system/hospital/doctor/update',
    method: 'post',
    data: {
      status: data.status,
      doctorUuid: data.doctorUuid,
      department: data.department,
      name: data.name,
      password: data.password,
      pictureName: data.pictureName,
      picture: data.picture,
      price: data.price,
      sex: data.sex,
      account: data.account,
      type: data.type,
      works: data.works
    }
  })
}

// 查找医生详细信息
export function getDoctorDetails (data) {
  return request({
    url: '/hospital-system/hospital/doctor/show',
    method: 'post',
    data: {
      hospitalUuid: data.hospitalUuid,
      doctorUuid: data.doctorUuid
    }
  })
}

// 查找医生信息
export function getDoctorDetail (data) {
  return request({
    url: '/hospital-system/hospital/doctor/get',
    method: 'post',
    data: {
      hospitalUuid: data.hospitalUuid
    }
  })
}

// 审批医生信息
export function checkDoctorIntroduce (data) {
  return request({
    url: '/hospital-system/hospital/doctor/introduce',
    method: 'post',
    data: {
      hospitalUuid: data.hospitalUuid,
      doctorUuid: data.doctorUuid,
      status: data.status,
      reason: data.reason
    }
  })
}

// 更新医生状态
export function changeDoctorStatus (data) {
  return request({
    url: '/hospital-system/hospital/doctor/change-status',
    method: 'post',
    data: {
      hospitalUuid: data.hospitalUuid,
      doctorUuid: data.doctorUuid,
      status: data.status,
      isDelete: data.isDelete
    }
  })
}

// 查找删除的医生
export function getDoctorDeleteList (data) {
  return request({
    url: '/hospital-system/hospital/doctor/delete-list',
    method: 'post',
    data: {
      hospitalUuid: data.hospitalUuid,
      doctorName: data.doctorName,
      department: data.department,
      times: data.times,
      currentPage: data.currentPage,
      pageSize: data.pageSize
    }
  })
}

// 获取定时任务信息
export function getQuartzCronMessage (data) {
  return request({
    url: '/hospital-system/hospital/task/get',
    method: 'post',
    data: {}
  })
}

// 设置医生下一周工作时间 定时任务开关
export function setQuartzCronTask (data) {
  return request({
    url: '/hospital-system/hospital/doctor/set-work-time',
    method: 'post',
    data: {
      hospitalUuid: data.hospitalUuid,
      weekDay: data.weekDay,
      dayTime: data.dayTime,
      status: data.status
    }
  })
}

// 更新医院信息
export function updateMessage (data) {
  return request({
    url: '/hospital-system/hospital/update-message',
    method: 'post',
    data: {
      html: data.html,
      status: data.status,
      isSell: data.isSell
    }
  })
}

// 获取医院信息
export function getDetailMessage (data) {
  return request({
    url: '/hospital-system/hospital/detail-message',
    method: 'post',
    data: {
      hospitalUuid: data.hospitalUuid
    }
  })
}
